using System;

namespace Microsoft.SqlServer.Tools.PublishWizard.CommandLine
{
	internal class PublishCommandLineParser : CommandLineParserBase
	{
		private string _syntax;

		internal override string Syntax
		{
			get
			{
				if (string.IsNullOrEmpty(this._syntax))
				{
					this._syntax = string.Concat(new string[]
					{
						CommandLineResources.CmdExeName,
						" ",
						CommandLineResources.PublishVerb,
						" ( -C ",
						CommandLineResources.ConnStrSyntax,
						" | -d ",
						CommandLineResources.DatabaseNameSyntax,
						" )  ( ",
						CommandLineResources.WebServiceOptionSyntax,
						" ) [",
						CommandLineResources.Switch,
						"]"
					});
				}
				return this._syntax;
			}
		}

		public PublishCommandLineParser()
		{
			base.RequiredDefaultCommands = 1;
		}

		public override bool CheckSyntax(object destination)
		{
			bool result = true;
			if (!base.CheckSyntax(destination))
			{
				return false;
			}
			PublishCommandLineArguments publishCommandLineArguments = (PublishCommandLineArguments)destination;
			if (string.IsNullOrEmpty(publishCommandLineArguments.ProviderName) && string.IsNullOrEmpty(publishCommandLineArguments.WebService) && string.IsNullOrEmpty(publishCommandLineArguments.WebServiceUserName) && string.IsNullOrEmpty(publishCommandLineArguments.WebServicePassword) && string.IsNullOrEmpty(publishCommandLineArguments.RemoteDatabaseName) && string.IsNullOrEmpty(publishCommandLineArguments.RemoteDatabasePassword) && string.IsNullOrEmpty(publishCommandLineArguments.RemoteDatabaseUserName) && string.IsNullOrEmpty(publishCommandLineArguments.RemoteServerName))
			{
				result = false;
				base.ShowErrorMessage(CommandLineResources.WebServiceRequired);
			}
			return result;
		}
	}
}
